package com.miot.restapi.controller;

import com.miot.object.scene.*;
import com.miot.restapi.util.DataResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.CompletableFuture;

/**
 * @Author: zhangyanbin
 * @Date: 2019/1/25 14:34
 * @Version 1.0
 */
@RestController
@RequestMapping("scene")
@Api(value = "scene", description = "场景控制器")
public class MiotSceneRestController {

    protected static Logger logger = LoggerFactory.getLogger(MiotSceneRestController.class);

    /**
     * 手机端-批量创建/修改场景
     *
     * @param sceneVo
     * @returnta
     */
    @PostMapping("/createScene")
    @ApiOperation(value = "保存场景接口", notes = "保存场景接口", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public CompletableFuture<DataResult> createScene(@RequestBody SaveSceneVo sceneVo) {
        return CompletableFuture.supplyAsync(() -> {
            logger.info("手机端-楼层添加接口参数->" + sceneVo);
            Long controlId = sceneVo.getControlId();
            String sceneName = sceneVo.getSceneName();
            return DataResult.ok("保存成功");
        });
    }
}
